/**
 * 2011-11-16下午8:32:24
 */
package dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import util.MysqlConn;
import bean.User;

/**
 * @author Baicai 根据学号查询指定user
 */
public class NewGoodsUserSelect {
	public static User getUser(String numString) {
		String sqlString = "select * from user where userinfo_num='"
				+ numString + "'";// 拼接sql字符串，查询指定学号的信息
		MysqlConn.setSqlString(sqlString);// 设置静态方法中的变量
		ResultSet resultSet;

		try {
			resultSet = MysqlConn.queryDB();
			resultSet.next();
			User user = new User();
			user.setUserId(resultSet.getInt("user_id"));
			user.setUserScore(resultSet.getInt("user_score"));
			user.setUserPhone(resultSet.getString("user_phone"));
			user.setUserInformation(resultSet.getString("user_information"));
			user.setUserinfoName(resultSet.getString("userinfo_name"));

			return user;

		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}// 以resultSet获取查询结果
		finally {
			MysqlConn.free();
		}
		return null;
	}
}
